<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>
    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <form class="form-horizontal" action="" name="myfromSubmit" method="post">
                        	<input type="hidden" value="{$data.id}" name="poster[id]" />
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right"  for="form-field-1"> 商家名称 </label>
                                <div class="col-sm-9">
                                    <input type="text" name="poster[shop_name]" datatype="*" nullmsg="商家名称不能为空" class="rcol-xs-10 col-sm-5" value="{$data.shop_name}">
                                </div>
                            </div>
							
                            <div class="space-4"></div>
							
							<div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 支付绑定 </label>
                                <div class="col-sm-9">
								<span style="float:left; line-height:32px;">支付宝：</span>
								<select name="poster[alipay_pay_id]" class="rcol-xs-5 col-sm-2">
									<option value="">请选择</option>
									<volist name="pay_data" id="vo">
									<eq name="vo.type" value="1">
									<option value="{$vo.id}" <if condition="$vo['id'] == $data['alipay_pay_id']">selected="selected"</if>>{$vo.title}</option>
									</eq>
									</volist>
								</select>
								<span style="float:left;line-height:32px; margin-left:15px;">微信：</span>
								<select name="poster[weixin_pay_id]" class="rcol-xs-5 col-sm-2">
									<option value="">请选择</option>
									<volist name="pay_data" id="vo">
									<eq name="vo.type" value="2">
									<option value="{$vo.id}" <if condition="$vo['id'] == $data['weixin_pay_id']">selected="selected"</if>>{$vo.title}</option>
									</eq>
									</volist>
								</select>
                                </div>
                            </div>
                             <div class="space-4"></div>
							
				<div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 企业身份 </label>
                                <div class="col-sm-9">
                                    <select name="poster[company_id]" id="company_id" class="rcol-xs-8 col-sm-5">
                                        <option value="0" id="company">请选择企业身份</option>
                                        <volist name="company" id="val">
                                            <option value="{$val.id}" <?php if($data['company_id'] == $val['id']):?>selected = "selected"<?php endif;?>>{$val.name}</option>
                                        </volist>
                                    </select>
                                </div>
                            </div>
							
                            <div class="space-4"></div>
							
							<div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 联系人 </label>
                                <div class="col-sm-9">
                                    <input type="text" name="poster[contact]" class="rcol-xs-10 col-sm-5" datatype="*" nullmsg="联系人不能为空" value="{$data.contact}">
                                </div>
                            </div>

                            <div class="space-4"></div>
							
							<div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 联系人电话 </label>
                                <div class="col-sm-9">
                                    <input type="text" name="poster[contact_tel]" class="rcol-xs-10 col-sm-5" datatype="m" nullmsg="联系电话不能为空" errormsg="电话格式错误" value="{$data.contact_tel}">
                                </div>
                            </div>

                            <div class="space-4"></div>

                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-2"> 商家地址 </label>
                                <div class="col-sm-9">
                                    <input type="text" name="poster[address]" class="rcol-xs-10 col-sm-5" datatype="*" nullmsg="商家地址不能为空" value="{$data.address}">
                                </div>
                            </div>
			   <div class="space-4"></div>
							
			  <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 登录用户名 </label>
                                <div class="col-sm-9">
                                    <input type="text" name="poster[username]" class="rcol-xs-10 col-sm-5" datatype="*" nullmsg="登录用户名不能为空" value="{$data.username}">
                                </div>
                            </div>
                            <div class="space-4"></div>
							
			  <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-2"> 用户密码 </label>
                                <div class="col-sm-9">
                                    <input type="password" name="poster[password]" id="password" placeholder="用户密码"
                                           class="col-xs-10 col-sm-5" value="">
                                    <span class="help-inline col-xs-12 col-sm-7">
												<span class="middle">留空不修改</span>
											</span>
                                </div>
                            </div>
                            <div class="space-4"></div>

                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="id-date-picker-1">授权时间</label>
                                <div class="col-xs-9 col-sm-9">
                                    <div class="input-group col-xs-5">
                                        <input class="form-control"  datatype="*" nullmsg="请选择商家的授权时间" id="auth_time" name="poster[auth_time]" value="<if condition="
                                               $data['auth_time'] neq '' ">{$data['auth_time']|date="Y-m-d",###}</if>"
                                        type="text" data-date-format="dd-mm-yyyy" />
                                        <span class="input-group-addon">
											<i class="ace-icon fa fa-calendar bigger-110"></i>
										</span>
                                    </div>
                                </div>
                            </div>
							
                            <div class="space-4"></div>
							
							<div class="form-group">
								<label class="col-sm-1 control-label no-padding-right" for="form-field-1">
									权限选择 </label>
                                <style>
									.show_fields_api{ width:400px; position:absolute;z-index:9999; background:#FFF;border:1px solid #ccc; margin:5px 0px 0px 75px;filter:progid:DXImageTransform.Microsoft.Shadow(color=#909090,direction=120,strength=3);-moz-box-shadow: 2px 2px 10px #909090;-webkit-box-shadow: 2px 2px 10px #909090;ox-shadow:2px 2px 10px #909090; display:none;}
									.show_fields_api dl{ width:380px; margin:10px; }
									.show_fields_api dl dd{ padding:10px 20px; float:left; }
									.arrow-inner{position:relative;left:13px;top:-6px;height:12px;width:12px;background:#fff;border-top:1px solid #ccc;border-left:1px solid #ccc;-webkit-transform:rotate(45deg);transform:rotate(45deg);}
									.show_api_close{ width:20px; height:20px; border-radius:20px; background:#09C; color:#fff; position:absolute; line-height:20px; text-align:center; margin:-18px 0px 0px 386px;}
									.fields_auth_show{ position:absolute; width:80px; height:30px; z-index:999; margin-left:80px; margin-top:-25px; display:block }
								</style>
								<div class="col-sm-9">
									<div class="col-sm-10">
									<volist name="auth_list" id="vo">
										<div class="row auth_row">
											<div class="widget-box">
												<div class="widget-header">
													<h4 class="widget-title">
														<label>
															<input class="ace ace-checkbox-2 father" <eq name="vo.checked" value="1">checked</eq> type="checkbox" value="1"/>
															<span class="lbl"> {$vo.title}</span>
														</label>
													</h4>
													<div class="widget-toolbar">
														<a href="#" data-action="collapse">
															<i class="ace-icon fa fa-chevron-up"></i>
														</a>
													</div>
												</div>
												<div class="widget-body">
													<div class="widget-main row">
													<volist name="vo.list" id="v" key="k">
                                                    	<span  class="col-xs-2" style="width:160px;" >
														<label>
															<input name="poster[api_role][{$vo.module}.{$v.method}]" <eq name="v.checked" value="1">checked</eq> class="ace ace-checkbox-2 children" type="checkbox" value="1"/>
															<span class="lbl"> {$v.title}</span>
														</label>
                                                        <eq name="v.mode_type" value="1">
                                                        <a class="fields_auth_show" href="javascript:void(0);">显示字段</a>
                                                        <div class="show_fields_api">
                                                            <div class="arrow-inner"></div>
                                                            <a href="javascript:void(0);" class="show_api_close">╳</a>
                                                            <dl>
                                                            <volist name="v.fields" id="vv">
                                                                <dd><label><input class="ace ace-checkbox-2 fields" <eq name="vv.checked" value="1">checked</eq> name="poster[api_role][{$vo.module}.{$v.method}][fields][{$vv[0]}]" type="checkbox" value="1" /> <span class="lbl">{$vv[1]}</span></label></dd>
                                                            </volist>
                                                            </dl>
                                                        </div>
                                                        </eq>
                                                        </span>
													</volist>
													</div>
												</div>
											</div>
										</div>
									</volist>
									</div>
								</div>
							</div>
							
							<div class="space-4"></div>
							
                            <div class="col-md-offset-2 col-md-9">
                                <button class="btn btn-info" type="submit">
                                    <i class="icon-ok bigger-110"></i>
                                    提交
                                </button>

                                &nbsp; &nbsp; &nbsp;
                                <button class="btn" type="reset">
                                    <i class="icon-undo bigger-110"></i>
                                    重置
                                </button>
                            </div>
                        </form>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script src="__PUBLIC__/qwadmin/js/date-time/bootstrap-datepicker.js"></script>
<script type="text/javascript">
    jQuery(function ($) {
        $('#auth_time').datepicker({
            format: 'yyyy-mm-dd',
            weekStart: 1,
            autoclose: true,
            todayBtn: 'linked',
            language: 'cn'
        });
    });
	$(".children").click(function () {
		if (this.checked) {
        	$(this).closest('.col-xs-2').find(".father").prop("checked", true);
			$(this).closest('.col-xs-2').find(".fields").prop("checked", true);
		} else {
			$(this).closest('.col-xs-2').find(".fields").prop("checked", false);
		}
    })
    $(".father").click(function () {
        if (this.checked) {
            $(this).parent().parent().parent().parent().find(".children").prop("checked", true);
			$(this).closest('.auth_row').find(".fields").prop("checked", true);
        } else {
            $(this).parent().parent().parent().parent().find(".children").prop("checked", false);
			$(this).closest('.auth_row').find(".fields").prop("checked", false);
        }
    });
	$("input.fields").click(function () {
        if (this.checked) {
            $(this).closest('span').find(".children").prop("checked", true);
			$(this).closest('.auth_row').find(".widget-title .father").prop("checked", true);
        }
    });
	$('a.fields_auth_show').click(function(){
		$('div.show_fields_api').each(function(){ $(this).hide(); });
		$(this).next().show();
	});
	$('a.show_api_close').click(function(){
		$(this).parent().hide();
	});
</script>
</body>
</html>
